package com.atwisdom.star.auth.service.impl;

import com.atwisdom.star.auth.mapper.AccountRoleMapper;
import com.atwisdom.star.auth.pojo.AccountRole;
import com.atwisdom.star.auth.service.AccountRoleService;
import com.atwisdom.star.common.util.CurrentDbType;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
* @author fushb
* @description 针对表【account_role】的数据库操作Service实现
* @createDate 2022-08-01 10:05:55
*/
@Service
public class AccountRoleServiceImpl extends ServiceImpl<AccountRoleMapper, AccountRole>
    implements AccountRoleService{
    @Autowired
    private CurrentDbType currentDbType;
    @Override
    public Map<String, Object> getTableColumns() {
        System.out.println(currentDbType.getType());
        return this.baseMapper.getTableColumns(currentDbType.getType());
    }

    @Override
    public List<AccountRole> selectByAccountId(Long accountId) {
        LambdaQueryWrapper<AccountRole> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(AccountRole::getAccountId, accountId);
        return this.baseMapper.selectList(wrapper);
    }
}




